<?php


namespace app\admin\service;

/**
 * 数组处理
 * @package app\admin\service
 */
class ArrayService
{
    public static function getValue($a,$k)
    {
        if (empty($k)) {
            if(!is_numeric($k))
            return '';
        }
        if (!is_array($a)) {
            return '';
        }
        if (array_key_exists($k, $a)) {
            return $a[$k];
        }
        return '';
    }
  public  static function startWith($haystack, $needle)
    {
        $length = strlen($needle);
        if ($length == 0) {
            return true;
        }
        return (substr($haystack, 0, $length) === $needle);
    }

}
